package net.kazed.nextaction.database.serialize;

import org.xml.sax.Attributes;

/**
 * Handle parsing of element.
 *
 * @author Koert Zeilstra
 */
public interface ElementHandler {

   /**
    * Element start.
    * @param name Element name.
    * @param attributes Element attributes.
    * @param state Parser state.
    */
   void startElement(String name, Attributes attributes, ParserState state);
   
   /**
    * Element text content.
    * @param text Element text contents.
    * @param state Parser state.
    */
   void characters(String text, ParserState state);
   
   /**
    * Element end.
    * @param name Element name.
    * @param state Parser state.
    */
   void endElement(String name, ParserState state);
   
   /**
    * Get nested element handler.
    * @param elementName Element name.
    * @return Nested element handler, null if no handler exists for elementName.
    */
   ElementHandler getElementHandler(String elementName);
   
   /**
    * @return True if text value is encoded.
    */
   boolean isValueEncoded();
}
